﻿
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OneShoppingDAL;
using OneShoppingModel;
using System.Data;
using OneShoppingBLL;
namespace OneShoppingUtility
{
    public class UtilitySql
    {
        public static int maxTradeCode(String table, String colums, int listId)
        {
            int maxTradeCode = 1000000;
            try
            {
                maxTradeCode = SqlUtility.GetInstance().CommonSelectMaxIdByCondition(table, colums, "ListId='" + listId + "'");
            }
            catch
            {
            }
            return maxTradeCode;
        }

        public static bool isOverActivityTotal(String table, int listId)
        {
            bool mark = false;
            Activity a = ActivityBLL.GetInstance().GetEntity(r => r.ListId == listId);
            if (a.Surplus <= 0)
            {
                mark = true;
            }
            return mark;
        }
        public static bool updateTables(string tableName, string columns, string conditions)
        {
            
            return SqlUtility.GetInstance().CommonUpdate(tableName, columns, conditions);
        }
       
       
    }
}
